<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ppctu="http://primefaces.org/ui" 
      xmlns:f="http://java.sun.com/jsf/core">
    <h:head>
        <title>Telecare Alarm Center</title>
        <link href="#{request.contextPath}/resources/img/favicon.ico" rel="shortcut icon" />    
        <h:outputStylesheet name="css/mainstyle.css"/>
    </h:head>
    <h:body>
    <div id="head">
        <div class="contenedor960">
            <span> Telecare Alarm Center </span>
        </div> <!-- fin contenedor960 -->
    </div> <!-- fin menu -->


    <div id="loginPanel" class="contenedor960">
      
    <ppctu:growl id="growl" showDetail="true" life="3000" />  
 
        <ppctu:panel id="dialog" header="Login" style="width:350px;height:200px;margin-top:100px;margin-left:auto;margin-right:auto;">
            <h:form>  
                <h:panelGrid columns="2" cellpadding="5">  
                    <h:outputLabel for="username" value="Username:" />  
                    <h:inputText value="#{loginBean.username}"   
                            id="username" required="true" label="username" />  

                    <h:outputLabel for="password" value="Password:" />  
                    <h:inputSecret value="#{loginBean.password}"   
                            id="password" required="true" label="password" />  

                    <f:facet name="footer"> 
                        <ppctu:commandButton value="Login" update="growl" 
                            action="#{loginBean.login}"
                            oncomplete="handleLoginRequest(xhr, status, args)"/>
                    </f:facet>  
                </h:panelGrid>  
            </h:form>
        </ppctu:panel>

    </div>
     <script type="text/javascript">  
        function handleLoginRequest(xhr, status, args) {  
            if(args.validationFailed || !args.loggedIn) {  
                jQuery('#dialog').effect("shake", { times:3 }, 100);  
            } else {
                window.location="faces/dock.xhtml";
                //dlg.hide();  
                //jQuery('#loginLink').fadeOut();  
                //jQuery('#loginPanel').load("/dock.xhtml #tableList");
                //windows.location.assign("/dock.xhtml");
            }  
        }  
    </script> 
    </h:body>
</html>

